#pragma once
#include "SceneManager.h"
#include "Object2D.h"
#include "Image.h"
#include "RealTimeController.h"
#include "Scene.h"
#include "ScreenText.h"
#include "Randomizer.h"
#include "TileSystem.h"
#include "Sprite.h"
#include "global_var.h"
#include "ScoreSystem.h"


#include <iostream>
using namespace std;
using namespace Pulpy;



#define MOVE_SPEED 10
#define JUMP_FORCE 30
#define EndTime 30.0f
#define GameEnd 3.0f

class EscapeRune : public Scene
{
private:
	TileSystem * ts;
	Object2D * _Char;
	Object2D * _Char2;
	Object2D SignalPage;
	Vector2D<float> _UpVel;
	Tile _CollideTile;
	bool _Jumping;
	int _Point;
	int _Point2;
	Object2D * _Sky;
	TextureImage _SkyTexture;
	Object2D * _Tree;
	TextureImage _TreeTexture;
	TextureImage * _CharImage;
	TextureImage * _CharImage2;
	TextureImage GameOver;
	TextureImage Image_SplashTime[5];
	TextureImage Hud[3];
	int _CharIndex;
	int _CharIndex2;
	float SplashTime;							
	float GameTime;	
	float point1;
	float point2;
	Sprite * P1run[2];
	Sprite * P2run[2];								
	int P1face;
	int P2face;
	float endT;

	Object2D P1Score_Word;						
	Object2D P1Score_Tenth;					
	Object2D P1Score_One;					
	Object2D P2Score_Word;				
	Object2D P2Score_Tenth;					
	Object2D P2Score_One;				
	Object2D Time_Word;							
	Object2D Time_Tenth;
	Object2D Time_One;


public:
	EscapeRune();
	void draw();
	void update();
	void reset();
	void freeResource();
	void loadResource();
	void handleKeyboard(int key, int x, int y);
	void handleKeyboardUp(int key, int x, int y);
	void handleKeyboardSpecial(int key, int x, int y);
	void getMid(int &x, int &y);
	void handleMouseClick(int button, int state, int x, int y);
	void handleMouseMove(int x, int y);

	void AIMove(int key, int x, int y);

};